﻿using ConsoleDispatch.DispatchParameter;
using GenericityDispatch;
using Newtonsoft.Json;
using System;

namespace ConsoleDispatch
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var baseBus = BaseBus.GetInstance();
                var parameter = new TestParameter<InputParameter, OutputParameter>()
                {
                    TestName = "张三",
                    Input = new InputParameter() { InputName = "InputName" },
                    Output = new OutputParameter() { OutputName = "OutputName" }
                };
                // 多节点调度
                baseBus.Publish(parameter);
                Console.WriteLine(JsonConvert.SerializeObject(parameter));

                //调度获取异常
                //baseBus.Publish(new Test2Parameter() { TestName = "李四" });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.WriteLine("Hello World!");
        }

    }
}
